﻿using ArchivingDataWebForms.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ArchivingDataWebForms.Pages.Files
{
    public partial class DisplayPdf : WebFormBase
    {
        public static string CasheName = "CasheName";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Request.QueryString[CasheName] != null && this.Request.QueryString[CasheName].ToString() != "")
            {
                this.Response.ClearContent();
                this.Response.ClearHeaders();
                this.Response.ContentType = "Application/pdf";

                byte[] pdfBytes = (byte[])this.Cache[this.Request.QueryString[CasheName]];
                //this.Cache[this.Request.QueryString[CasheName]] = null;
                this.Response.BinaryWrite(pdfBytes);
                this.Response.End();
            }
        }
    }
}